--Chat thing

Channels = {}
Channels.Current = ""

function Channels:GetCurrent()
	return self.Current
end

include( "gui/channel_elements.lua" )

include( "gui/channel_win.lua" )

-- Usermessage as small as possible to allow the most data sent through
usermessage.Hook( "ChC", function( data )
	local Colour = Color( data:ReadChar() + 128, data:ReadChar() + 128, data:ReadChar() + 128 )
	local Name = data:ReadString()
	local Colour2 = Color( data:ReadChar() + 128, data:ReadChar() + 128, data:ReadChar() + 128 )
	local Text = data:ReadString()
	
	chat.AddText( Colour, Name .. ": ", Colour2, Text  )
	chat.PlaySound()
end )

usermessage.Hook( "ChN", function( data )
	local Chan = data:ReadString()
	Channels.Current = string.lower( Chan )
	
	print( "Apparently, you're in the channel " .. Chan )
end )

usermessage.Hook( "ChE", function( data )
	local Name = data:ReadString()
	local Channel = data:ReadString()
	
	Channels.List:AddChannel( Name, Channel, data:ReadBool() )
end )